// 工厂模式
class AutomakerShop {
    createHamburger() {
        throw new Error("不能调用抽象方法")
    }
    createCoke() {
        throw new Error("不能调用抽象方法")
    }
}
class Hamburger {
    price() {
        throw new Error("不能调用抽象方法")
    }
}

class Coke {
    price() {
        throw new Error("不能调用抽象方法")
    }
}

class xiaowangHamburger extends Hamburger {
    price() {
        return "20"
    }
}

class xiaowangCoke extends Coke {
    price() {
        return "30"
    }
}

class xiaowangShop extends AutomakerShop {
    createHamburger() {
        return new xiaowangHamburger()
    }
    createCoke() {
        return new xiaowangCoke()
    }
}



export default function (name) {
    switch (name) {
        case 'Hamburger':
            return new Hamburger()
        case 'Coke':
            return new Coke()
    }
}